
package com.joysuch.wwyt.datadump.biz.query;

import cn.zlg.common.datadump.condition.QueryCondtionDef;
import cn.zlg.common.datadump.condition.QueryFieldCondition;
import cn.zlg.common.datadump.condition.QueryFieldConditionSet;
import cn.zlg.common.datadump.condition.SortFieldDef;
import com.joysuch.wwyt.bp.entity.dsl.QBpDepart;
import com.joysuch.wwyt.bp.entity.dsl.QBpJob;
import com.querydsl.core.types.Order;

import java.util.Arrays;
import java.util.List;

public class BpJobDumpQueryBean implements QueryCondtionDef {

    @Override
    public List<QueryFieldConditionSet> getConditionSet() {
        return Arrays.asList(
                QueryFieldConditionSet.Builder().names("showState").or(
                        new QueryFieldCondition("showState", QBpJob.bpJob, QBpJob.bpJob.showState,
                                QBpJob.bpJob.id, "ne"),
                        new QueryFieldCondition("showState", QBpJob.bpJob, QBpJob.bpJob.showState,
                                QBpJob.bpJob.id, "isNull")
                ).build()
        );
    }

    @Override
    public QueryFieldCondition[] getAllConditionDef() {
        return new QueryFieldCondition[] {
                new QueryFieldCondition("ids", QBpJob.bpJob, QBpJob.bpJob.id, QBpJob.bpJob.id, "in"),
                new QueryFieldCondition("name", QBpJob.bpJob, QBpJob.bpJob.name, QBpJob.bpJob.id, "contains"),
        };
    }

    @Override
    public SortFieldDef[] getAllSortFieldDef() {
        return new SortFieldDef[] { new SortFieldDef(QBpJob.bpJob.name, "name", Order.ASC) };
    }
}
